package vek.GUI.Infoview;

import javax.swing.JEditorPane;
import vek.controllers.Info.WebsiteViwerController;

/**
 * This class loads the website using WebsiteLoader and then shows it. 
 * @author Christian, Michal og Jakob (Hold 1, gruppe 2)
 */
public class WebsiteViewer extends JEditorPane {
    
    private String urlToPage;
    private WebsiteViwerController wvController;
    
    public WebsiteViewer(String url)
    {
        urlToPage = url;
        wvController = new WebsiteViwerController();
        
        setEditable(false); // makes websites uneditable (JEditorPanes are set to edit by default)
        //methods
        addHyperlinkListener(wvController); //adds a hyperlink listener so that hyperlinks can be clicked
     
    }
    
    /**
     * Loads the website.
     * @param s the url of the website to be loaded
     */
    
    public void setPageURL(String s)
    {
        new WebsiteLoader(this).loadPage(s);
    }
    
    

}
